﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Mobile_H.Master" Inherits="System.Web.Mvc.ViewPage<Bias_Stock.Models.CountCartModel.PlyRoll_DS>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Tag_Cart
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <style type="text/css">
        input.ui-input-text
        {
            height: 25px;
            background-color: #FFF;
            border: 1px solid #bbbbbb;
            -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.3) inset;
            -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.3) inset;
            box-shadow: 0 1px 3px rgba(0,0,0,0.3) inset;
            width: 95%;
        }
        
        .hide
        {
            display: none;
        }
        tr
        {
            height: 35px;
            text-align: right;
            background-color: #fff;
        }
        tr.dis
        {
            background-color: #FFFFC2;
        }
    </style>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
    <div style="background-color: #8094AE; height: 50px; margin-top: 0px;">
        <h2 style="color: White; vertical-align: middle;">
            &nbsp;COUNT</h2>
    </div>
    <div id="page1">
        <table style="width: 100%; font-size: medium; color: #004080; padding: 5px; font-weight: bold;">
            <tr class="dis">
                <td style="width: 35%; text-align: right;">
                    DATE : &nbsp;
                </td>
                <td style="text-align: left;">
                    &nbsp;&nbsp;
                    <%= WinNemoLib.DateUtil.ToDisplayDate(DateTime.Now) %>
                </td>
            </tr>
            <tr class="dis">
                <td>
                    EMP : &nbsp;
                </td>
                <td style="text-align: left;"> &nbsp;&nbsp; <%= User.Identity.Name.ToString() %>
                </td>
            </tr>
                      <tr  id="area" class="dis">
                <td>
                    Area : &nbsp;
                </td>
                <td style="text-align: left;">
                    &nbsp;&nbsp;<%: Model._area %>
                </td>
            </tr>
            <tr class="dis">
                <td class="dis">
                   Cart  : &nbsp;
                </td>
                <td style="text-align: left;">
                      &nbsp;&nbsp;<%: Model._cartno %>
                </td>
            </tr>
                <tr class="dis">
                <td >
                Size  : &nbsp;
                </td>
                <td style="text-align: left;">
                &nbsp;&nbsp;<%: Model._sizes %>
                </td>
                </tr>
                <tr class="dis">
                <td >
                PLY  : &nbsp;
                </td>
                <td style="text-align: left;">
                &nbsp;&nbsp;<%: Model._Ply %>
                </td>
                </tr>
            <tr>
                <td>
                   M.  : &nbsp;
                </td>
                <td style="text-align: left;">
                    <input type="text" class="ui-input-text" />
                </td>
            </tr>
            <% if (Model._topsheet != "0")
               { %>
                  <tr>
                <td>
                  Top  : &nbsp;
                </td>
                <td style="text-align: left;">
                    <input type="checkbox" id="top" />
                </td>
            </tr>
            <%} %>
            <% if (Model._tapesheet != "0")
               { %>
                          <tr>
                <td>
                  Tape  : &nbsp;
                </td>
                <td style="text-align: left;">
                    <input type="checkbox" id="tape" />
                </td>
            </tr>
            <%} %>
                          <tr>
                <td>
                  NG  : &nbsp;
                </td>
                <td style="text-align: left;">
                    <input type="checkbox" id="ng" />
                </td>
            </tr>
        </table>
      <div style="float:left; width: 40%">  <input type="button" id="back" value="Back" style="width: 100%" /></div>
      <div style="float:right; width:45%">   <input type="button" id="save" value="Save" style="width: 100%" /></div>
    </div>
    
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server">
<% if (false)
   { %>
<script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<% } %>

<script type="text/jscript">

    $(function () {
        $("input.ui-input-text").focus();
        
        if ('<%:Model._tapesheet %>' != 0) {
            $("#tape").attr("checked", "checked");
        }
        if ('<%:Model._topsheet %>' != 0) {
            $("#top").attr("checked", "checked");
        }
        $("input.ui-input-text").autoNumeric({ vMin: '0', vMax: '299', aPad: false });

        $("#back").click(function () {
            window.location = '<%= Url.Action("Cart_Tag") %>' + '?area=' + '<%: Model._area %>';
        });

        $("#save").click(function () {
            if ($("input.ui-input-text").val() == "") {
                alert("Input Meter");
                $("input.ui-input-text").focus();
                return;
            }

            var dataForSubmit = new Array();

            dataForSubmit.push({
                _biasno: '<%: Model._biasno %>',
                _plandt: '<%: Model._plandt %>',
                _itemno: '<%: Model._itemno %>',
                _sitemno: '<%: Model._sitemno %>',
                _forming: '<%: Model._forming %>',
                _sizes: '<%: Model._sizes %>',
                _side: '<%: Model._side %>',
                _rollno: '<%: Model._rollno %>',
                _Ply: '<%: Model._Ply %>',
                _cartno: '<%: Model._cartno %>',
                _plylen: $("input.ui-input-text").val(),
                _tapesheet: ($('#tape:checked').length > 0) ? "X" : "",
                _topsheet: ($('#top:checked').length > 0) ? "X" : "",
                _ng: ($('#ng:checked').length > 0) ? "X" : "",
                _area: '<%: Model._area %>',
                _Exp: '<%: Model._Exp %>',
                _tag: '<%: Model._tag %>'
            });
            var getUsersUrl = '<%= Url.Action("Save_Cart") %>';
            callScriptMethod(getUsersUrl, { theData: dataForSubmit });
        });


        function callScriptMethod(url, jsonObject, action, callback, async) {

            callback = callback || function () { };
            async = (async == null || async);

            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: url,
                data: JSON.stringify(jsonObject),
                dataType: "json",
                async: async,
                success: function (data) {

                    if (data.success != "1") {
                        alert(data.message);
                    } else {

                        alert("Save Complete");
                        window.location = '<%= Url.Action("Cart_Tag") %>' + '?area=' + '<%: Model._area %>'
                    }
                },
                error: function (xhr, status, error) {
                    var err = xhr.responseText;
                    alert(err.Message);
                }
            });
        }
    });
</script>
</asp:Content>
